﻿<%@  codepage="65001" %>
<%if session("login")<>"ok" then%>
<script language="JavaScript">
    location.href="login.asp"
</script>
<%
response.End
end if%>
<%
Session.CodePage=65001
Response.Charset="utf-8"
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("data.mdb")


'connstr = "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("test.mdb")
conn.open connstr
'查询一级片区
set rs= server.createobject("adodb.recordset")
sqlstr = "select * from userInfo"
rs.open sqlstr,conn,1,1
strUserTree = "{text: '公司人员',expanded:true,lnglat: '',children: ["
if rs.RecordCount <> 0 then
	Do while not rs.eof or rs.bof
		strUserTree = strUserTree & "{text:'"&rs("username")&"',userId:'"&rs("userId")&"',id:'"&rs("id")&"',leaf:true"
		'strUserTree = strUserTree &",checked: false"
		strUserTree = strUserTree &"},"
		rs.movenext
	loop
	'去掉最后一个逗号
	strUserTree = left(strUserTree,len(strUserTree)-1)
else
	strUserTree = strUserTree & "{text:'无',userId:''}"
end if
strUserTree = strUserTree &"]}"
conn.close
%>

<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>网点查询地图系统</title>
    <link rel="stylesheet" type="text/css" href="ext/ext-3.4.1/resources/css/ext-all.css" />

    <link rel="stylesheet" type="text/css" href="ext/ext-3.4.1/examples/ux/css/Spinner.css" />
    <script type="text/javascript" src="ext/ext-3.4.1/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="ext/ext-3.4.1/ext-all.js"></script>
    <script type="text/javascript" src="ext/ext-3.4.1/examples/ux/ux-all.js"></script>
    <script type="text/javascript" src="ext/ext-3.4.1/examples/ux/DateTimeField.js"></script>
    <script type="text/javascript" src="citys/tree.js"></script>
    <script type="text/javascript" src="citys/tree_checked.js"></script>
    <script language="javascript" src="http://api.51ditu.com/js/maps.js"></script>
    <script language="javascript" src="http://api.51ditu.com/js/rego.js"></script>
    <script language="javascript" src="http://api.51ditu.com/js/ezmarker.js"></script>
    <script type="text/javascript" src="http://api.51ditu.com/js/bus.js"></script>
    <script language="javascript" src="http://api.51ditu.com/js/navigate.js"></script>
    <script type="text/javascript" src="back_play.js"></script>
    <style type="text/css">
        v\:* {
            behavior: url(#default#VML);
        }
    </style>
    <style type="text/css">
        .zhandian01 {
            background-image: url("icons/bus/zhandian01.gif");
            background-position: left top;
            background-repeat: no-repeat;
            display: inline;
            float: left;
            height: 28px;
            margin: 0 auto;
        }

        .zhandian02 {
            background-image: url("icons/bus/zhandian02.gif");
            background-position: center top;
            background-repeat: repeat-x;
            border-right: 1px solid #666666;
            display: inline;
            float: left;
            line-height: 21px;
            margin: 0 5px 0 14px;
            padding-right: 4px;
        }

        .x-slider-horz {
        }
    </style>
    <script type="text/javascript">
        Ext.BLANK_IMAGE_URL = 'ext/ext-3.4.1/resources/images/default/s.gif';
        var strUserTree = [<%=strUserTree%>];	//片区树
        var maps;
        var userId = null;
        var markerLineInfoTracks = [];
        //var areaColor = "";
        var pageSize = 50;	//每页显示的最大值
        var     dataWindow;
        Ext.onReady(function(){

        
            playBtn = new Ext.Button({ text: '播放', handler: PlayFn })

            runFn = lTPointsPlayer;
            playForm = new Ext.FormPanel({
                //   region: 'center',
                frame: true,
                labelAlign: 'right',
                labelWidth: 55,
                width: 240,//addLTLineOverlay
                //   buttons: [{ xtype: 'button', text: 'addMark', handler: function () { addMarkermap(maps) } },
                //       { xtype: 'button', text: 'addLTLineOverlay', handler: function () { addLTLineOverlay(maps) } }],
                waitMsgTarget: true,
                items: [
                         /* {   xtype : "fieldset",  
                              title:'',
                              autoWidth: true,
                              autoHeight: true,
                                    
                              items : [new Ext.form.RadioGroup(
                                {
                                    itemId: '',
                                    fieldLabel: '视野',
                                    //    width:180,
                                    items: [
                                         new Ext.form.Radio({            //以上相同
                                             boxLabel: "锁定",
                                             name: "borrow",
                                             inputValue: "lock"

                                         }), new Ext.form.Radio({
                                             boxLabel: "自由",
                                             name: "borrow",
                                             checked: true,
                                             inputValue: "free"

                                         })
                                    ]
                                }),*/
                                  new Ext.form.ComboBox({
                                      id: 'stepLength',
                                      fieldLabel: '回放间隔',
                                      typeAhead: true,
                                      triggerAction: 'all',
                                      lazyRender: false,
                                      mode: 'local',
                                      width: 130,
                                      value: '1',
                                      store: new Ext.data.ArrayStore({
                                          id: 0,
                                          fields: [
                                              'myId',
                                              'displayText'
                                          ],
                                          data: [[1, 'X 1'], [2, 'X 2'], [3, 'X 3'], [4, 'X 4']]
                                      }),
                                      listeners: {

                                          select: updateStepLength
                                      },
                                      valueField: 'myId',
                                      displayField: 'displayText'

                                  }),
                                  new Ext.form.SliderField({
                                      id: 'playRate',
                                      fieldLabel: '回放速度',
                                      width: 140,
                                      value: 0,
                                      increment: 1,
                                      minValue: 1,
                                      maxValue: 4,

                                      markInvalid: function (msg) {
                                          var field = this
                                          field.el.addClass(field.invalidClass);
                                          if (!field.errorIcon) {
                                              var elp = field.getErrorCt();
                                              // field has no container el
                                              if (!elp) {
                                                  field.el.dom.title = msg;
                                                  return;
                                              }
                                              field.errorIcon = elp.createChild({ tag: 'div', style: 'text-align:center;width:22px;padding-top:4px; background-color:#e9f2ff;border:#8eaace  solid 1px;', html: msg });

                                              if (field.ownerCt) {
                                                  field.ownerCt.on('afterlayout', field.alignErrorIcon, field);
                                                  field.ownerCt.on('expand', field.alignErrorIcon, field);
                                              }
                                              field.on('resize', field.alignErrorIcon, field);
                                              field.on('destroy', function () {
                                                  Ext.destroy(this.errorIcon);
                                              }, field);
                                          }
                                          field.alignErrorIcon();
                                          field.errorIcon.dom.qtip = field.getValue();;
                                          field.errorIcon.dom.innerHTML = field.getValue();

                                          field.errorIcon.show();

                                      },
                                      getErrors: function (v) {
                                          return [v];
                                      },

                                      listeners: {
                                          afterrender: function (tslider) {
                                              tslider.slider.on('change', function (ts, v) {
                                                  tslider.markInvalid();
                                                  updatePlayRate(v);
                                              })
                                          }
                                      }
                                  }),
                                  new Ext.form.SliderField({
                                      fieldLabel: '回放进度',
                                      width: 140,
                                      value: 0,
                                      increment: 1,
                                      minValue: 0,
                                      //maxValue: 1000,
                                      id: 'playProgress',
                                      markInvalid: function (msg) {
                                          var field = this
                                          field.el.addClass(field.invalidClass);
                                          if (!field.errorIcon) {
                                              var elp = field.getErrorCt();

                                              if (!elp) {
                                                  field.el.dom.title = msg;
                                                  return;
                                              }
                                              field.errorIcon = elp.createChild({ tag: 'div', style: 'text-align:center;width:22px;padding-top:4px; background-color:#e9f2ff;border:#8eaace  solid 1px;', html: msg });

                                              if (field.ownerCt) {
                                                  field.ownerCt.on('afterlayout', field.alignErrorIcon, field);
                                                  field.ownerCt.on('expand', field.alignErrorIcon, field);
                                              }
                                              field.on('resize', field.alignErrorIcon, field);
                                              field.on('destroy', function () {
                                                  Ext.destroy(this.errorIcon);
                                              }, field);
                                          }
                                          field.alignErrorIcon();
                                          field.errorIcon.dom.qtip = field.getValue();
                                          field.errorIcon.dom.innerHTML = field.getValue();

                                          field.errorIcon.show();

                                      },
                                      getErrors: function (v) {
                                          return [v];
                                      },

                                      listeners: {
                                          afterrender: function (tslider) {
                                              tslider.slider.on('change', function (ts, v) {
                                                  tslider.markInvalid();
                                                  playForm.get('playProgress').setMaxValue(pointDatas.length - 1);
                                                  dragplay(v)
                                              })
                                          }
                                      }
                                  }),
                                   {
                                       xtype: "fieldset",
                                       title: '',
                                       layout: 'column',

                                       autoHeight: true,
                                       defaultType: 'button',
                                       items: [{ text: '快退', handler: quickBack },
                                               playBtn,
                                               { text: '停止', handler: playStop },
                                               { text: '快进', handler: quickPlay }

                                       ]
                                   }, {
                                       hidden:true,
                                       id: 'ivalue',
                                       xtype: 'textfield'
                                   }, {
                                       hidden:true,
                                       id: 'ivalue2',
                                       xtype: 'textfield'
                                   }

                              //]}
                ]


            });
   


      
            dataWindow = new Ext.Window({
                title: '回放控制',
                width: 280,
                height:245,
                minWidth: 280,
                minHeight: 245,
                maxWidth: 280,
                maxHeight: 245,
                layout: 'fit',
                modal : false,
                closable:true,
                closeAction:'hide',
                plain:true,
                bodyStyle:'padding:5px;',
                buttonAlign:'center',
                x:0,
                y:200,
                items: playForm
        
            });




            maps = new LTMaps( "myMap" );
            maps.centerAndZoom(new LTPoint(10444800,3514368),13);	//定位全国
            var standMapControl = new LTStandMapControl();
            maps.addControl(standMapControl);
            maps.handleMouseScroll(true);//启用鼠标滚轮功能支持,参数true代表使用鼠标指向点位置不变模式
            control=new LTPolyLineControl();//增加测距控件
            control.setTips("双击结束");//改变操作提示文字内容
            LTEvent.bind(maps,"dblclick",control,control.endDraw);//在双击地图的时候调用结束操作
            maps.addControl(control);
            controlm=new LTPolygonControl();
            controlm.setTips("双击结束");//改变操作提示文字内容
            LTEvent.bind(maps,"dblclick",controlm,controlm.endDraw);//在双击地图的时候调用结束操作
            maps.addControl(controlm);
            control.setVisible(false);
            controlm.setVisible(false);
	
            // 布局开始
            var viewport = new Ext.Viewport({
                layout:'border',
                items:[{
                    region: 'north',
                    contentEl: 'north-div',
                    height: 55,
                    bodyStyle: 'background-color:#BBCCEE;'
                },{
                    region:'center',
                    xtype:'panel',
                    title:'地图',
                    tbar:[
                        {text:'放大',handler:function(){maps.zoomIn();}},
                        {text:'缩小',handler:function(){maps.zoomOut()}},
                        {text:'测距',handler:function(){control.btnClick();}},
                        {text:'测面',handler:function(){controlm.btnClick();}},
                        {text:'打印',handler:function(){printMap(maps)}},
                        {text:'清空地图',handler:function(){maps.clearOverLays();}}
                    ],
                    //bbar:[{text:'全部网点显示',handler:function(){maps.clearOverLays();
                    //				customerJsonStore.removeAll();
                    //				customerJsonStore.load({params: {start:0,limit:pageSize,citycode:"",type:"init"},callback:function(r,options,success){if(ds.getCount() == 0){Ext.MessageBox.alert('提示', "搜索无结果");}}});
                    //					//加载JSON数据给地图对象
                    //					ds.addListener('load', function(st, rds, opts){
                    //						if(maps)
                    //						{
                    //							maps.clearOverLays();
                    //						}
                    //					});
                    //				}
                    //			}],
                    tools:[{id:""}],
                    listeners:{"bodyresize":function(){if(typeof(maps)=="object"){maps.resizeMapDiv();}}},//监控地图大小改变后,地图自适应
                    contentEl:'myMap'
			
			
			
                    /*,
                    collapsible:true,
                    split: true,
                    border: true,
                    //layout: 'border',
                    layout: 'accordion',
                    layoutConfig:{
                        titleCollapse:true,
                        animate:true
                        //,
                        //activeOnTop:false
                    },
                    width:250,
                    items: [formTracksSearch,grid]*/
                }
                ,{
                    region: 'south',
                    contentEl: 'south-div',
                    height: 200,
                    bodyStyle: 'background-color:#BBCCEE;',
                    id:"southID"
			
                    /*,
                    collapsible:true,
                    border: true
                    ,
                    items: [grid]*/
                }
                ,{
                    //region: 'east',
                    region: 'west',
                    collapsible:true,
                    split: true,
                    border: true,
                    //layout: 'border',
                    layout: 'accordion',
                    layoutConfig:{
                        titleCollapse:true,
                        animate:true,
                        activeOnTop:false
                    },
                    width:250,
                    items: [formTree,formTracksSearch]
                }
                ]
            });
            // 布局结束
            //地图打印
            function printMap(maps)
            {
                var html = "<!DOCTYPE HTML\">\n";
                html += (document.all)?"<html xmlns:v=\"urn:schemeas-microsoft-com:vml\">":"<html>";
                html += "\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\n<title>Print Maps<\/title>\n";
                html += "<style type=\"text\/css\">\nbody {margin: 0px;}\n";
                html += (document.all)?"v\\:*{ Behavior:url(#default#VML);}":"";
                html += "\n</style>\n";
                html += "<\/head>\n";
                html += "<body><right>\n";
                html += maps.getMapContent(0);//改变"0"这个参数，可以将地图之中的标注也打印到地图，具体请参照类参考文档之中的getMapContent说明
                html += "\n<\/right><\/body>\n<\/html>";
                var win = window.open("about:blank","win","menubar=1,width="+(maps.container.offsetWidth)+",height="+(maps.container.offsetHeight-20));
                win.document.writeln(html);
                win.moveTo(0,0);
                win.print();
                win.document.close();	
                win.close();
            }
            //Ext.fly(Ext.get('treeCitysSearch')).setHeight(parseInt(document.body.clientHeight)-122-108,true)
            //treeCitysSearch.setHeight(parseInt(document.body.clientHeight)-122-117);
	
            var south = Ext.getCmp('southID');  
            //alert(south);
            south.collapse();
            treeCitysSearch.setHeight(parseInt(document.body.clientHeight)-122-70);
        });

        Ext.EventManager.onWindowResize(function(width,height){//改变窗口的时候会提示出窗口的宽高
            treeCitysSearch.setHeight(parseInt(height)-122-70);
        });

        //-----------------------------------------地区导航开始-----------------------------------------------
        //加载城市列表
        var treeCitysSearch = new Ext.tree.TreePanel({
            loader: new Ext.tree.TreeLoader(),
            //title: '地区导航',
            id:"treeCitysSearch",
            el:'treeCitysSearch',
            split: true,
            //border: true,
            rootVisible:false,
            autoScroll: true,
            //bodyStyle : 'overflow-x:visible; overflow-y:visible',
            autoHeight:false,
            width: 310
        });

        var rootCitysSearch = new Ext.tree.AsyncTreeNode({
            text:'root',
            expanded :true,
            width:"100%",
            //height:"1000px",
            children:strUserTree	//不带复选框的城市列表
        });
        treeCitysSearch.setRootNode(rootCitysSearch);
        treeCitysSearch.expand();

        treeCitysSearch.on("click", function(node){
            formTracksSearch.expand();
            Ext.getCmp("userTracksKeyWord").setValue(node.text);
            userId = node.attributes.userId;
        });

        treeCitysSearch.on('checkchange', function(node, flag){
	
        });

        var formTree = new Ext.form.FormPanel({
            defaultType: 'textfield',
            labelAlign: 'right',
            title: '公司人员',
            labelWidth: 60,
            frame:true,
            width: 310,
            //height:300,
            autoHeight:false,
            buttonAlign: 'center',
            //bodyStyle : 'overflow-x:visible; overflow-y:visible',
            //autoHeight:150,
            //region: 'north',
            //reader: reader,
            items: treeCitysSearch
        });
        //-----------------------------------------地区导航结束--------------------------------------------------

        //-----------------------------------------轨迹信息查询开始-----------------------------------------------
        //轨迹信息查询
        var formTracksSearch = new Ext.form.FormPanel({
            id: 'formTracksSearchID',
            name: 'formTracksSearchID',
            title: '轨迹查询',
            autoHeight: true,
            frame: true,
            layout: "form", // 整个大的表单是form布局
            labelWidth: 60,
            labelAlign: "right",
            items: [
               
                    
                            {
                                xtype: 'textfield',
                                name:'userTracksKeyWord',
                                id:'userTracksKeyWord',
                                fieldLabel: '人员'  ,
                                //anchor: '100%',
                                width:150,
                                value:"",
                                readOnly:true
                            },
                            {
                                xtype : 'datetimefield',
                                fieldLabel : '开始时间',
                                editable:false,
                                name:'startTime',
                                id:'startTime',
                                format : 'Y-m-d H:i:s',
                                invalidText : '日期不正确，请输入\'YYYY-MM-dd\'格式',
                                width:150
                                //,value:"2013-6-25 00:00:00"
                                //,value:new Date(parseInt((row?row.get("startTime"):extTime).split("-")[0]),parseInt((row?row.get("startTime"):extTime).split("-")[1])-1,parseInt((row?row.get("startTime"):extTime).split("-")[2]))
                                //value:new Date((row?row.get("endTime"):extTime).split("-")[0],(row?row.get("endTime"):extTime).split("-")[1],(row?row.get("endTime"):extTime).split("-")[2])
                                //							,
                                //							minValue : new Date(),
                                //							minText : '请选择今天之后的日期'
                            },
                            {
                                xtype : 'datetimefield',
                                fieldLabel : '结束时间',
                                name:'endTime',
                                id:'endTime',
                                editable:false,
                                format : 'Y-m-d H:i:s',
                                invalidText : '日期不正确，请输入\'YYYY-MM-dd\'格式',
                                width:150
                                //,value:"2013-6-25 23:59:59"
                                //,value:new Date(parseInt((row?row.get("endTime"):extTime).split("-")[0]),parseInt((row?row.get("endTime"):extTime).split("-")[1])-1,parseInt((row?row.get("endTime"):extTime).split("-")[2]))
                                //							,
                                //							minValue : new Date(),
                                //							minText : '请选择今天之后的日期'
                            }
              

        
            ],
            buttons:     [     
        { xtype:'button',
            text: '查询',
            handler:function(){
                dataWindow.show();
                var times = Ext.get("startTime").getValue().split(" ");
                var timee = Ext.get("endTime").getValue().split(" ");
                var startTime_ = strtotime(times[0],times[1]);
                var endTime_ = strtotime(timee[0],timee[1]);
                //var url = "httpHeader.asp";
                //var data = "token="+token+"&url="+escape("http://api.laijiaoliu.com/location/usertrack?startTime="+startTime+"&endTime="+endTime+"&userId="+userId);
			
                Ext.Ajax.request({
                    url:"userToken.asp",
                    method:'post',
                    params:{
                        //userId:userId
                        userId:51649347
                    },
                    success:function(req){
                        //alert(req.responseText);
                        var obj = Ext.util.JSON.decode(req.responseText);
                        if(obj.num==1||obj.num=="1")
                        {
                         
                            if(obj.token!="")
                            {
                                Ext.Ajax.request({
                                    url:"httpHeader.asp",
                                    method:'post',
                                    params:{
                                        token:obj.token,//'UjBEa3dlcUZSVDFydkRoRlozM1VsQT09OlN6d0FOcG0vL2dhUzM2eThhT2ZjRmc9PQ',
                                        url:("http://api.laijiaoliu.com/location/usertrack?startTime="+startTime_+"&endTime="+endTime_+"&userId="+userId)
                                    },
                                    success:function(req){
                                        var obj = Ext.util.JSON.decode(req.responseText);
                                        alert(obj.msg)
                                        for(var i=0;i<markerLineInfoTracks.length;i++)
                                        {
                                            map.removeOverlay(markerLineInfoTracks[i]);
                                        }
                                        var points = [];
                                        if(obj.length>0)
                                        {
                                            for (var i=0;i<obj.length;i++)
                                            {
                                             //   alert(obj[i].coords)
                                                (function(){
                                                    //POINT (39.90733636652002 116.4655952877506)
                                                    var pointStr = obj[i].coords.substring(7);
                                                    pointStr = pointStr.substring(0,pointStr.length-1);
                                                    pointStr = pointStr.split(" ");
                                                    if (!(/(^[1-9]\d*$)/.test(pointStr[0])))
                                                    {
                                                        pointStr[0] = pointStr[0]*100000;
                                                        pointStr[1] = pointStr[1]*100000;
                                                    }
                                                    points.push(new LTPoint(pointStr[1],pointStr[0]));
                                                    var iconUrl="icons/usertrack.png";
                                                    var icon2=new LTIcon(iconUrl,[20,21],[10,21]);//创建一个图标
                                                    var marker = new LTMarker(new LTPoint(pointStr[1],pointStr[0]),icon2);
                                                    maps.addOverLay(marker);
                                                    var markerText = new LTMapText(marker);
                                                    maps.addOverLay(markerText);
                                                    markerText.setLabel("<font style='font-weight:700;font-size:12px;'>"+(i+1)+"</font>");
                                                    markerLineInfoTracks.push(marker);
                                                    markerLineInfoTracks.push(markerText);
                                                    var obj_ = obj[i];
                                                    LTEvent.addListener(marker,"click",function(){
                                                        //创建信息框对象
                                                        var infoWin = new LTInfoWindow(marker.getPoint(),[0,-21]);
                                                        infoWin.setHeight(70);
                                                        infoWin.setWidth(130);
                                                        //设置信息框的经纬度
                                                        infoWin.setPoint(marker.getPoint());
                                                        //infoWin.setTitle(username);
                                                        //设置信息框的内容简介
                                                        infoWin.setLabel("<font style='font-weight:700;font-size:14px;'>创建时间</font><br><font style='font-size:12px'>"+obj_.createTime.split(".")[0].replace("T"," ")+"</font>");
                                                        //将信息框添加到地图上
                                                        maps.addOverLay(infoWin);
													
                                                    });
                                                })();
                                            }
                                            lTPoints=points;
                                            addLTLineOverlay(maps)
                                            var option = new LTLineOptions(); 
                                            option.points = points; 
                                            //根据点数组创建一条折线 
                                            var polyLine = new LTLineOverlay(option); 
                                            //将折线添加到地图 
                                            maps.overlayManager.addOverLay(polyLine);
                                            polyLine.getObject().style.zIndex = 480;
                                            markerLineInfoTracks.push(polyLine);
                                            maps.getBestMap(points);
                                        }
                                    }
                                });
                            }
                        }
                    }
                });
			
                //Ext.Ajax.request({
                //				url:"httpHeader.asp",
                //				method:'post',
                //				params:{
                //					token:"<%=session("token")%>",
                //					url:("http://api.laijiaoliu.com/location/usertrack?startTime="+startTime_+"&endTime="+endTime_+"&userId="+userId)
                //				},
                //				success:function(req){
                //					//alert(req.responseText);
                //					var obj = Ext.util.JSON.decode(req.responseText);
                //					//json = [{"source":"android","userId":10,"createTime":"2013-06-25T03:05:47.000+0000","coords":"POINT (39.914 116.478368)"},{"source":"iphone","userId":10,"createTime":"2013-06-25T03:21:21.000+0000","coords":"POINT (39.90723249154987 116.4655934424251)"},{"source":"android","userId":10,"createTime":"2013-06-25T03:22:19.000+0000","coords":"POINT (39.914037 116.478324)"},{"source":"iphone","userId":10,"createTime":"2013-06-25T03:30:59.000+0000","coords":"POINT (39.90740506888032 116.4656033731351)"},{"source":"android","userId":10,"createTime":"2013-06-25T03:36:10.000+0000","coords":"POINT (39.914011 116.478358)"},{"source":"iphone","userId":10,"createTime":"2013-06-25T03:47:40.000+0000","coords":"POINT (39.9071992400459 116.4656570549754)"},{"source":"android","userId":10,"createTime":"2013-06-25T11:55:17.000+0000","coords":"POINT (39.977918 116.454509)"},{"source":"android","userId":10,"createTime":"2013-06-25T11:56:38.000+0000","coords":"POINT (39.97804 116.455213)"},{"source":"android","userId":10,"createTime":"2013-06-25T12:11:41.000+0000","coords":"POINT (39.977918 116.454509)"},{"source":"android","userId":10,"createTime":"2013-06-25T12:45:48.000+0000","coords":"POINT (39.981628 116.460679)"}];
                //					for(var i=0;i<markerLineInfoTracks.length;i++)
                //					{
                //						map.removeOverlay(markerLineInfoTracks[i]);
                //					}
                //					var points = [];
                //					if(obj.length>0)
                //					{
                //						for (var i=0;i<obj.length;i++)
                //						{
                //							(function(){
                //								//POINT (39.90733636652002 116.4655952877506)
                //								var pointStr = obj[i].coords.substring(7);
                //								pointStr = pointStr.substring(0,pointStr.length-1);
                //								pointStr = pointStr.split(" ");
                //								
                //								if (!(/(^[1-9]\d*$)/.test(pointStr[0])))
                //								{
                //									pointStr[0] = pointStr[0]*100000;
                //									pointStr[1] = pointStr[1]*100000;
                //								}
                //								
                //								points.push(new LTPoint(pointStr[1],pointStr[0]));
                //								
                //								//var marker = new BMap.Marker(new BMap.Point(pointStr[1],pointStr[0]),{icon:new BMap.Icon("icons/usertrack.png", new BMap.Size(22,21),{anchor:new BMap.Size(10,11)})});
                //								//var label = new BMap.Label("<font style='font-weight:700;font-size:12px;'>"+(i+1)+"</font>",{offset:new BMap.Size(22,10)});
                //								//marker.setLabel(label);
                //								//将标注添加到地图中
                //								//map.addOverlay(marker);
                //								
                //								var iconUrl="icons/usertrack.png";
                //								var icon2=new LTIcon(iconUrl,[20,21],[10,21]);//创建一个图标
                //								var marker = new LTMarker(new LTPoint(pointStr[1],pointStr[0]),icon2);
                //								maps.addOverLay(marker);
                //								var markerText = new LTMapText(marker);
                //								maps.addOverLay(markerText);
                //								markerText.setLabel("<font style='font-weight:700;font-size:12px;'>"+(i+1)+"</font>");
                //								
                //								markerLineInfoTracks.push(marker);
                //								markerLineInfoTracks.push(markerText);
                //								
                //								var obj_ = obj[i];
                //								LTEvent.addListener(marker,"click",function(){
                //									//创建信息框对象
                //									var infoWin = new LTInfoWindow(marker.getPoint(),[0,-21]);
                //									infoWin.setHeight(70);
                //									infoWin.setWidth(130);
                //									//设置信息框的经纬度
                //									infoWin.setPoint(marker.getPoint());
                //									//infoWin.setTitle(username);
                //									//设置信息框的内容简介
                //									infoWin.setLabel("<font style='font-weight:700;font-size:14px;'>创建时间</font><br><font style='font-size:12px'>"+obj_.createTime.split(".")[0].replace("T"," ")+"</font>");
                //									//将信息框添加到地图上
                //									maps.addOverLay(infoWin);
                //									
                //								});
                //								
                //								/*var htm = '<div style="background-image:url(icons/usertrack.png); width:22px; height:21px; text-align:center"><font style="font-weight:700;font-size:12px;">'+(i+11)+'</font></div>';
                //								var point = new BMap.Point(pointStr[1],pointStr[0]);
                //								var marker= new BMapLib.RichMarker(htm,point,{"anchor" : new BMap.Size(-5,-11),"enableDragging" : false});
                //								map.addOverlay(marker);*/
                //								
                //								//创建信息窗口
                //								//var infoWindow = new BMap.InfoWindow("<font style='font-weight:700;font-size:14px;'>创建时间</font><br><font style='font-size:12px'>"+obj[i].createTime.split(".")[0].replace("T"," ")+"</font>",{offset:new BMap.Size(0,-11)});
                //								//marker.addEventListener("click", function(){this.openInfoWindow(infoWindow);});
                //								//markerLineInfoTracks.push(infoWindow);
                //							})();
                //						}
                //						
                //						var option = new LTLineOptions(); 
                //						option.points = points; 
                //						//根据点数组创建一条折线 
                //						var polyLine = new LTLineOverlay(option); 
                //						//将折线添加到地图 
                //						maps.overlayManager.addOverLay(polyLine);
                //						polyLine.getObject().style.zIndex = 480;
                //						//var polyline = new BMap.Polyline(points,{strokeColor:"blue", strokeWeight:3, strokeOpacity:0.5});
                //						//map.addOverlay(polyline);
                //						markerLineInfoTracks.push(polyLine);
                //						//map.setViewport(points);
                //						maps.getBestMap(points);
                //						//map.panTo(points[0]);
                //					}
                //				}
                //			});
            }
        }]
        });
        //-----------------------------------------轨迹信息查询结束----------------------------------------

        function indexOfStr(val,text){
            for(var i = 0; i < val.length; i++)
            {
                if(val[i] == text)return i;
            }
            return -1;
        }

        function removeStr(val,text){
            var index = indexOfStr(val,text);
            if (index > -1) {
                val.splice(index, 1);
            }
        }

        var imgDefaultWidth = 210;
        var imgDefaultHeight = 160;
        var imgDefaultWidthZoomIn = 250;
        var imgDefaultHeightZoomOut = 200;
        function imgZoomIn(self)
        {
            self.style.width=imgDefaultWidthZoomIn;
            self.style.height=imgDefaultHeightZoomOut;
            self.style.position="relative";
            self.style.left = (-(imgDefaultWidthZoomIn-imgDefaultWidth)/2)+"px";
            self.style.top = (-(imgDefaultHeightZoomOut-imgDefaultHeight)/2)+"px";
            self.style.zIndex = 1;
        }

        function imgZoomOut(self)
        {
            self.style.width=imgDefaultWidth;
            self.style.height=imgDefaultHeight;
            self.style.left = "0px";
            self.style.top = "0px";
        }

        function loginOut()
        {
            Ext.Ajax.request({
                url:'loginout.asp',
                method:'get',
                params:{
                    uid:'uid'
                },
                success:function(req){
                    //alert(req.responseText);
                    //window.close();
                    location.href="login.asp";
                    /*if(req.responseText=='ok')
                    {
                        Ext.Msg.alert('success','You got it!');
                    }
                    else
                    {
                        Ext.Msg.alert('sorry','You lost!');
                    }*/
                }
            });
        }

        function loginAdmin()
        {
            location.href="admin.asp";
        }

        function obj2str(o){
            var r = [];
            if(typeof o =="string") return "\""+o.replace(/([\'\"\\])/g,"\\$1").replace(/(\n)/g,"\\n").replace(/(\r)/g,"\\r").replace(/(\t)/g,"\\t")+"\"";
            if(typeof o =="undefined") return "";
            if(typeof o == "object"){
                if(o===null) return "null";
                else if(!o.sort){
                    for(var i in o)
                        r.push(i+":"+obj2str(o[i]))
                    r="{"+r.join()+"}"
                }else{
                    for(var i =0;i<o.length;i++)
                        r.push(obj2str(o[i]))
                    r="["+r.join()+"]"
                }
                return r;
            }
            return o.toString();
        }

        /**
        * 日期转化成时间戳
        * 日期格式 2011-02-02 21:12:13
        * time_str:日期段 2011-02-02
        * fix_time:时间段 21:12:13
        */
        function strtotime(time_str, fix_time)
        {
            var time = (new Date()).getTime();
            if(time_str)
            {//有日期段
                var str = time_str.split('-');
                if (3 === str.length)
                {
                    var year = parseInt(str[0]) - 0; 
                    var month = parseInt(str[1]) - 0 - 1;//月份是从0开始的
                    var day = parseInt(str[2]) - 0;
                    if(fix_time)
                    {//有时间段
                        var fix = fix_time.split(':');
                        if(3 === fix.length)
                        {
                            var hour = parseInt(fix[0]) - 0; 
                            var minute = parseInt(fix[1]) - 0;
                            var second = parseInt(fix[2]) - 0;
                            time = (new Date(year, month, day, hour, minute, second)).getTime();
                        }
                    }
                    else
                    {
                        time = (new Date(year, month, day)).getTime();
                    }
                }
            }
            //getTime()获取的时间戳到了毫秒数
            //time = time / 1000;//转到到秒数
            return time;
        }
    </script>
    <style type="text/css">
        <!--
        .style1 {
            font-size: 14px;
            font-weight: bold;
        }
        -->
        body {
            text-align: left;
        }
    </style>
</head>
<body>
    <!--<div id="north-div">
  <div class="style1" id="menu">网点查询系统</div>
</div>-->
    <div id="north-div" style="background-image: url(images/bg_head.jpg)">
        <img src="images/logoTop.jpg">
        <div class="style1" style="display: none" id="menu">网点查询系统</div>
        <!--<div style="cursor:pointer" onClick="loginOut();">
  	<div style="position:absolute; right:80; top:15;font-size:12px; background-image:url(images/exit.jpg); width:20px; height:18px"></div><div style="position:absolute; right:30; top:15;font-size:12px">退出系统</div>
  </div>
  <div style="cursor:pointer" onClick="loginAdmin();">
  	<div style="position:absolute; right:200; top:15;font-size:12px; background-image:url(images/admin.jpg); width:20px; height:20px"></div>
	<div style="position:absolute; right:125; top:15;font-size:12px">登录管理页面</div>
  </div>-->
    </div>
    <div id="treeCitysSearch"></div>
    <div id="treeSaleAreaSearchDiv"></div>
    <div id="myMap" style="position: relative; width: 100%; height: 100%; border: black solid 0px;"></div>
    <div id="south-div" style="font-size: 12px;"><%=CC_CopyRight%></div>
    <div id="tree-panel"></div>
</body>
</html>
